<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
     *{
                margin: 0px;
                padding: 0px;
                list-style: none;
            }
            ul{
                overflow: hidden;
                margin: 20px auto;
                height: 30px;
                width: 485px;
            }
    
            
            li{
                float: left;
                width:120px;
                text-align: center;
                height: 30px;
                /* 垂直居中 */
                line-height: 30px;
                cursor: pointer;
            }
            div{
                width: 800px;
                height: 300px;
                text-align: center;
                line-height: 300px;
                border:2px solid red;
                /* 隐藏标签 */
                display: none;
                margin: auto;
                background-image: url(images/hzr.jpg);
                background-size: 801px;
                color: red;
            }
            li:hover{
                background: saddlebrown;
            }
            li.current{
                color:black;
            }
            div.current{
                display: block;
            }
</style>
<body>
    <ul>
        <li class="current">选我</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
    </ul>
    <section>
        <div class="current">111</div>
        <div>222</div>
        <div>333</div>
        <div>444</div>
    </section>
    <script>
        var tags=document.getElementsByTagName('li');
        var boxs=document.getElementsByTagName('div');
        for(var i=0;i<tags.length;i++){
            tags[i].index=i;
            tags[i].onclick=function(){
                for(var j=0;j<tags.length;j++){
                    tags[j].className=''
                    boxs[j].className=''
                }
                this.className='current';
                var n=this.index;
                boxs[n].className='current'
            }
        }
    </script>
</body>
</html>